package com.kkkkkba.search.dataSource;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.kkkkkba.search.service.UserService;
import com.kkkkkba.search.model.dto.user.UserQueryRequest;
import com.kkkkkba.search.model.vo.UserVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;

/**
 * 用户服务实现
 *

 */
@Service
@Slf4j
public class UserDataSource implements DataSource<UserVO>{

    @Resource
    private UserService userService;

    @Override
    public Page<UserVO> doSearch(String searchText, long PageNum, long PageSize) {
        UserQueryRequest userQueryRequest = new UserQueryRequest();
        userQueryRequest.setUserName(searchText);
        userQueryRequest.setCurrent(PageNum);
        userQueryRequest.setPageSize(PageSize);
        Page<UserVO> page = userService.listUserPageByPage(userQueryRequest);
        return page;
    }

//    @Override
    public Page<UserVO> doSearchByPage(String searchText, long PageNum, long PageSize) {
        UserQueryRequest userQueryRequest = new UserQueryRequest();
        userQueryRequest.setUserName(searchText);
        userQueryRequest.setCurrent(PageNum);
        userQueryRequest.setPageSize(PageSize);
        Page<UserVO> page = userService.listUserPageByPage(userQueryRequest);
        return page;
    }


}
